package text;

import java.io.*;

public class Text02 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        File dir = new File(".");
        File[] subs = dir.listFiles((f)->f.getName().endsWith("obj"));

        for(int i=0;i<subs.length;i++){
            File sub = subs[i];//从数组中获取每一个obj文件
            FileInputStream fis = new FileInputStream(sub);
            ObjectInputStream ois= new ObjectInputStream(fis);
            Object obj = ois.readObject();
            if(obj instanceof User) {
                User user = (User) obj;
                ois.close();
                System.out.println(user);

            }
        }

    }
}
